import Store from '@/utils/Storage';
import CacheEnum from '@/enums/CacheEnum'

const state = {
    userInfo: null,
    captcha: null
}

const getters = {
    getCaptcha(state) {
        return state.captcha
    },
    getUserInfo(state) {
        state.userInfo = Store.get(CacheEnum.USER_INFO)
        return state.userInfo
    }
}

const mutations = {
    setCaptcha(state, value) {
        state.captcha = value
    },
    setUserInfo(state, value) {
        state.userInfo = value
        Store.set(CacheEnum.USER_INFO, value)
    }
}

const actions = {}

export default {
    namespaced: true,
    state,
    getters,
    mutations,
    actions,
}
